<!doctype html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<title>商家后台首页</title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<link rel="stylesheet" type="text/css" href="__MERCHANT_STATIC__/hui/static/h-ui/css/H-ui.min.css" />
	<link rel="stylesheet" type="text/css" href="__MERCHANT_STATIC__/hui/static/h-ui.admin/css/H-ui.admin.css" />
	<link rel="stylesheet" type="text/css" href="__MERCHANT_STATIC__/hui/lib/Hui-iconfont/1.0.8/iconfont.css" />
	<link rel="stylesheet" type="text/css" href="__MERCHANT_STATIC__/hui/static/h-ui.admin/skin/default/skin.css" id="skin" />
	<link rel="stylesheet" type="text/css" href="__MERCHANT_STATIC__/hui/static/h-ui.admin/css/style.css" />
	<link rel="stylesheet" type="text/css" href="__MERCHANT_STATIC__/style/css/h-ui/css/H-ui.min.css">
	<link rel="stylesheet" type="text/css" href="__MERCHANT_STATIC__/style/css/page.css">
	<link rel="stylesheet" type="text/css" href="__MERCHANT_STATIC__/style/css/public.css">
	<link rel="stylesheet" type="text/css" href="__MERCHANT_STATIC__/style/css/style.css">
	<link rel="stylesheet" type="text/css" href="__MERCHANT_STATIC__/style/css/styled.css" />


	<script type="text/javascript" src="__MERCHANT_STATIC__/hui/lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="__MERCHANT_STATIC__/hui/lib/layer/2.4/layer.js"></script>
	<script type="text/javascript" src="__MERCHANT_STATIC__/hui/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
	<script type="text/javascript" src="__MERCHANT_STATIC__/hui/lib/jquery.validation/1.14.0/validate-methods.js"></script>
	<script type="text/javascript" src="__MERCHANT_STATIC__/hui/lib/jquery.validation/1.14.0/messages_zh.js"></script>
	<script type="text/javascript" src="__MERCHANT_STATIC__/hui/static/h-ui/js/H-ui.js"></script>
	<script type="text/javascript" src="__MERCHANT_STATIC__/hui/static/h-ui.admin/js/H-ui.admin.page.js"></script>
	<script type="text/javascript" src="__MERCHANT_STATIC__/style/js/page.js"></script>
	<script type="text/javascript" src="__MERCHANT_STATIC__/style/js/jqueryui.js"></script>
	<script type="text/javascript" src="__MERCHANT_STATIC__/style/js/jquery.shapeshift.min.js"></script>
	<script type="text/javascript" src="__MERCHANT_STATIC__/style/js/vue.js"></script>
	
	<script type="text/javascript" src="__MERCHANT_STATIC__/hui/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<link rel="stylesheet" href="__MERCHANT_STATIC__/style/css/zyupload-1.0.0.css " type="text/css">

	<!-- <link href="__WWW_STATIC__/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="__WWW_STATIC__/lib/fileinput/css/fileinput.css" media="all" rel="stylesheet" type="text/css"/>
    <link href="__WWW_STATIC__/lib/fileinput/themes/explorer/theme.css" media="all" rel="stylesheet" type="text/css"/> -->

	<script src="__WWW_STATIC__/lib/plupload/plupload.full.min.js"></script>
	<script src="__MERCHANT_STATIC__/style/js/uploadfile/uploadfile.js" type="text/javascript"></script>
	<script src="__WWW_STATIC__/lib/fileinput/js/plugins/sortable.js" type="text/javascript"></script>
	<!-- <script src="__WWW_STATIC__/lib/fileinput/js/fileinput.js" type="text/javascript"></script> -->
	<!-- <script src="__WWW_STATIC__/lib/fileinput/js/locales/zh.js" type="text/javascript"></script>
    <script src="__WWW_STATIC__/lib/fileinput/js/locales/fr.js" type="text/javascript"></script>
    <script src="__WWW_STATIC__/lib/fileinput/js/locales/es.js" type="text/javascript"></script>
    <script src="__WWW_STATIC__/lib/fileinput/themes/explorer/theme.js" type="text/javascript"></script>
    <script src="__WWW_STATIC__/lib/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> -->

	<style>
		a {
			color: #000;
		}

		#header {
			padding-left: 50px;
		}

		a:hover {
			color: #000;
		}

		.dropDown {
			margin: 18px 31px 0 0;
		}

		p {
			color: #444;
		}

		.lab {
			font-size: 14px;
			color: #444;
		}

		ul li {
			cursor: pointer;
		}

		.actives {
			background: #43b9ec;
			color: #fff;
		}

		.amark {
			color: #FF0000;
		}
		.typesingle--selected{
			color: #fff;
		}

		input[type=checkbox],
		input[type=radio] {
			display: inline;
		}
		/* 图片上传相关css */

		.update_goodsCommonR {
			padding: 15px;
			box-sizing: border-box;
		}

		.upload_image {
			border: 1px solid #999;
			box-sizing: border-box;
			height: 150px;
			width: 150px;
			display: block;
			background-image: url("__MERCHANT_STATIC__/style/img/upload.png");
		}

		.img_upload_list {
			/* margin-bottom: 10px; */
		}

		.img_upload_list:after {
			content: "";
			display: block;
			clear: both;
		}

		.img_upload_single {
			margin-right: 15px;
			margin-bottom: 15px;
			width: 150px;
			position: relative;
			float: left;
		}

		.img_upload_single:hover .upload_delete {
			display: block;
			text-decoration: none;
		}

		.upload_delete {
			position: absolute;
			height: 30px;
			width: 30px;
			color: #fff !important;
			background-color: #000;
			border-radius: 50%;
			text-align: center;
			line-height: 30px;
			top: -10px;
			right: -10px;
			font-size: 25px;
			display: none;
		}

		.goods_lease_add {
			background-color: #2196f3;
			height: 40px;
			width: 150px;
			text-align: center;
			line-height: 40px;
			border-radius: 3px;
			color: #fff;
			cursor: pointer;
			display: block
		}

		.goods_lease_mess {
			border: 1px solid #e8e8e8;
			height: 40px;
			line-height: 40px;
			box-sizing: border-box;
			text-align: center;
			font-size: 16px;
			color: #333;
			margin-top: 10px;
			width: 100%;
		}

		a {
			color: #333;
		}

		.dropDown {
			margin: 18px 31px 0 0;
		}

		.margin {
			padding-left: 50px;
			height: 100% !important;
			box-sizing: border-box;
			width: 100% !important;
		}

		.logo>img {
			height: 100%;
		}

		.btn-success>span{
			color: #fff;
		}
		.header_common>li {
			line-height: 100px;
			height: 100px;
			margin: 0;
		}

		.header_common>li>a {
			line-height: 100px !important;
		}

		.header_common>li:nth-of-type(1) {
			margin-right: 15px;
		}

		.header_common>li:nth-of-type(1)>img {
			margin-top: 30px;
			border-radius: 3px;
		}

		.header_common>li:nth-of-type(2) {
			margin-right: 55px;
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
			max-width: 85px;
		}

		.header_common>li:nth-of-type(2)>a {
			font-size: 16px !important;
			color: #fff !important;
		}

		.header_common>li:nth-of-type(3)>a {
			font-size: 16px !important;
			color: #2196f3 !important;
		}

		.header_common>li:nth-of-type(2)>a:hover {
			background-color: transparent;
			/* color: #2196f3 !important; */
		}

		.header_common>li:nth-of-type(3)>a:hover {
			background-color: transparent;
			/* color: #fff !important; */
		}

		.update_goodsCommonMess {
			padding-left: 230px;
			box-sizing: border-box;
		}

		.update_addresschange td:nth-of-type(1) {
			width: 200px;
		}

		.update_addresschange td:nth-of-type(3) {
			width: 90px;
		}

		.update_addressshop td:nth-of-type(1) {
			width: 200px;
		}

		.update_addressshop td:nth-of-type(3) {
			width: 90px;
		}
		/* 商品规格选中样式改变 */

		.goodsadd_type--selected>input {
			cursor: default;
			text-align: center;
			color: #fff;
			background-color: #2196f3;
			border: none;
		}

		.goodsadd_type--selected>span {
			display: none;
		}

		.goodsadd_type--selected:hover>span {
			display: block;
		}

		.goodsadd_type_maxnumber {
			border: 1px solid #dadada;
			text-indent: 10px;
			font-size: 15px;
			color: #333;
			width: 100px;
			border-radius: 3px;
			margin-right: 10px;
		}
		/* #goods_more_list>li{
			position: absolute;
		} */
		.copydata{
			color:#999;
		}
		.copydata>button{
			width: 80px;
			font-size: 15px;
			height: 30px;
			border: none;
			margin: 10px;
			display: inline-block;
			
				}
	</style>
</head>

<body>

	<div class="kong">
		<div style="width: 100%;background: #313130;border-bottom: 1px solid #e8e8e8;height:100px;box-sizing:border-box">
			<div id="header" class="margin">
				<div class="logo" style="margin-top:0"><img src="__MERCHANT_STATIC__/style/img/official_logo.png" alt=""></div>
				<!-- 个人登录功能区域 -->
				<div id="Hui-userbar" class="nickname nav navbar-nav navbar-userbar hidden-xs">
					<ul class="header_common">
						<li><img src="__MERCHANT_STATIC__/style/img/dian.jpg" alt="" style="width: 40px;height:40px;"></li>
						<li class=""> <a href="javascript:void(0);" class="dropDown_A" style="color: #000;">店铺名称</a>
						</li>
						<li><a href="{:url('index/loginOut')}">退出</a></li>
					</ul>
				</div>
			</div>
		</div>
	</div>

	{include file="common/menu" /}
	<div class="dislpayArrow hidden-xs"><a class="pngfix" href="javascript:void(0);" onClick="displaynavbar(this)"></a></div>
	<div class="Hui-article-box" style="margin-top: 37px;overflow-y:auto">
		<h2 class="update_title">商品>编辑商品</h2>
		<form id="frm" action="" class="update_form">
			{:token()}
			<div class="update_goodsTop">
				<div class="lab">
					<span><i class="update_red">*</i>商品类目</span>
					<input type="hidden" name="goods_category_id" value="{$goodsdata['goods_category_id']}" />
					<input type="hidden" name="goods_id" value="{$goodsdata['goods_id']}" />
					<input type="hidden" name="goods_merchant_id" value="{:session('merchant.merchant_id')}" />
					<span id="span_catname">{$catName}</span>
					<a href="javascript:setDiv_Cate();" style="margin-left:0px">选择类目</a>
					<!-- 商品类别选择器 ，使用定位-->
					<div id="div_main" class="update_goodsType">
						<div id="div_cate" class="wareSort clearfix" style="display:none;min-height: 130px;">
							<ul id="sort1" style="width: 200px;">
								{foreach($datacate as $kdatacate => $vdatacate)}
								<li onclick="findChild({$vdatacate['goods_category_id']},this)">{$vdatacate['goods_category_name']}</li>
								{/foreach}
							</ul>
							<ul id="sort2" style="display: none;width: 200px;">
							</ul>
							<ul id="sort3" style="display: none;width: 200px;">
							</ul>
						</div>
					</div>
					<!-- 商品类别选择器 -->
				</div>
				<div class="lab">
					<span><i class="update_red">*</i>商品名称</span>
					<input type="text"  value="{$goodsdata['goods_name']}" id="goods_name" onpropertychange="checkcount()" oninput="checkcount()"
					    name="goods_name" class="input-text radius size-M" placeholder="请输入商品名称，不超过30个字">
					<span id="span_namecount">0/30</span>
				</div>
				<div class="lab">
					<span>         免押金</span>
					<?php 
						if($goodsdata['goods_is_free_deposit']=='1')
						{
						echo '<input type="checkbox"  class="checkbox" checked="checked" name="goods_is_free_deposit"      >';
						}
						else
						{
						echo '<input type="checkbox"  class="checkbox"  name="goods_is_free_deposit"      >';
						
						}
						
						?> 消费者下单时不需支付商品押金
				</div>
				<div class="lab">
					<span>                  免赔</span>
					<?php 
						if($goodsdata['goods_is_deductible']=='1')
						{
						echo '<input type="checkbox" class="checkbox" checked="checked" name="goods_is_deductible"      >';
						}
						else
						{
						echo '<input type="checkbox"  class="checkbox"  name="goods_is_deductible"      >';
						
						}
						
						?> 物品轻微损坏无需赔偿，轻微损坏范围见商家说明
				</div>
				<div class="lab">
					<span>随租随还</span>

					<?php   
						if($goodsdata['goods_is_follow_lease']=='1')
						{
						
						echo '<input type="checkbox"  class="checkbox" checked="checked" name="goods_is_follow_lease"      >';
						}
						else
						{
						 
						echo '<input type="checkbox"  class="checkbox"  name="goods_is_follow_lease"      >';
						
						}
						
						?> 租赁的商品提前归还时，只收取实际租赁时间的租金,退还剩余租金
				</div>
			</div>
			<div class="update_goodsBottom">
					<div class="lab cl">
							<div class="lab-l">每笔限租</div>
							
						<p class="update_goodsCommonMess"><input  class="goodsadd_type_maxnumber" name='goods_max_count' type="number" max="50" min="1" name="" value="{$goodsdata['goods_max_count']}" onblur="checkMaxCount(this)"> 消费者每笔订单限租件数最高为50件</p>
						
					</div>
					<div id="vue-contaniner">
							<div class="lab cl">
								<div class="lab-l"><i class="update_red">*</i>租用周期</div>
								<div class="lab-r" style="border:0;">
									<ul class="lab-list">
										<li id="li1" :class="{'btn-success':timelist[0]==1}" @click="timeSelect(0,'日')"  style="position:relative;">
											<input type="text" name="rent_period_type[]" class="radius" style="cursor:pointer;width:50px;height: 33px;opacity:0;text-align: center;line-height: 33px;"
												value="" />
											<span class="yue" style="position: absolute;left:17px;top:0px;">日</span></li>
										<li id="li2" :class="{'btn-success':timelist[1]==1}" @click="timeSelect(1,'周')" style="position:relative;">
											<input type="text" name="rent_period_type[]" class="radius" style="cursor:pointer;width:50px;height: 33px;opacity:0;text-align: center;line-height: 33px;"
												value="" />
											<span class="yue" style="position: absolute;left:17px;top:0px;">周</span></li>
										<li id="li3" :class="{'btn-success':timelist[2]==1}" @click="timeSelect(2,'月')"  style="position:relative;">
											<input type="text" name="rent_period_type[]" class="radius" style="cursor:pointer;width:50px;height: 33px;opacity:0;text-align: center;line-height: 33px;"
												value="" />
											<span class="yue" style="position: absolute;left:17px;top:0px;">月</span></li>
										<li id="li4" :class="{'btn-success':timelist[3]==1}" @click="timeSelect(3,'季')" style="position:relative;">
											<input name="rent_period_type[]" type="text" class="radius" style="cursor:pointer;width:50px;height: 33px;opacity:0;text-align: center;line-height: 33px;"
												value="" />
											<span class="yue" style="position: absolute;left:17px;top:0px;">季</span></li>
										<li id="li5" :class="{'btn-success':timelist[4]==1}" @click="timeSelect(4,'年')" style="position:relative;">
											<input name="rent_period_type[]" type="text" class="radius" style="cursor:pointer;width:50px;height: 33px;opacity:0;text-align: center;line-height: 33px;"
												value="" />
											<span class="yue" style="position: absolute;left:17px;top:0px;">年</span></li>
									</ul>
								</div>
							</div>
							<div class="lab cl">
								<input type="hidden" name="rent_type_list" value="">
								<div class="lab-l">商品规格</div>
								<div class="update_goodsTypeChoose">
									<div>
										<div class="lab-text">
											<div>
												<input type="text" class="input-text radius size-M edit update_goodsTypeTag" name="key" tabindex="2" onMouseOver="this.className='input_1'"
													onMouseOut="this.className='input_2'" disabled="disabled" value="颜色" 　readOnly="true">
											</div>
										</div>
										<div class="cl update_goodsTagList">
											<ul class="outer_one set" v-for="item,index in typelist[0]">
												<!-- vue模板渲染区域 -->
													<li :class="{'goodsadd_type--selected':item.noblur}" class="update_goodsTypeTitle" style="position:relative;">
														<input v-model="item.size"  @blur.stop="typeblur(0,index)" @focus.stop="typefocus(0,index)" type="text" placeholder="点击编辑" class="input-text radius size-M edit input_one">
														<span @click.stop="deltype(0,index)" style="position:absolute;top:-10px;right:0px;font-size:20px;cursor:pointer;" >x</span>
													</li>
												<!-- vue模板渲染区域 -->
											</ul>
											<div class="add_one addl" @click="addtype(0)">+添加</div>
										</div>
									</div>
									<div>
										<div class="lab-text">
											<div>
												<input type="text" name="key[]" class="input-text radius size-M edit update_goodsTypeTag" tabindex="2" onMouseOver="this.className='input_1'"
													onMouseOut="this.className='input_2'" disabled="disabled" value="规格" 　readOnly="true" class="input-text radius size-M edit">
											</div>
										</div>
										<div class="cl update_goodsTagList">
											<ul class="outer_two sets" v-for="item,index in typelist[1]">
												<!-- vue模板渲染区域 -->
													<li :class="{'goodsadd_type--selected':item.noblur}"  class="update_goodsTypeTitle" style="position:relative;">
														<input v-model="item.size" @blur.stop="typeblur(1,index)" @focus.stop="typefocus(1,index)"  type="text" placeholder="点击编辑" class="input-text radius size-M edit input_two">
														<span @click.stop="deltype(1,index)" style="position:absolute;top:-10px;right:0px;font-size:20px;cursor:pointer;">x</span>
													</li>
												<!-- vue模板渲染区域 -->
											</ul>
											<div class="add_two adds" @click="addtype(1)">+添加</div>
										</div>
									</div>
								</div>
							</div>
							<div class="lab cl">
								<div class="lab-l"><i class="update_red">*</i>商品定价</div>
								<!-- 商品定价参数说明 -->
								<div class="update_goodsPrice">
									<div class="lab-top">
										<p class="can update_goodsPriceBook" style="width:100px;cursor:pointer">显示参数说明</p>
										<div class="lab-show">
											<div class="update_goodsPrames" style="display:none">
												<table class="table table-border table-bg  table-bordered">
													<tr class="first-tr">
														<th>最小周期</th>
														<th>最大周期</th>
														<th>现租价</th> 
														<!-- <th>活动价</th>  -->
														<th>续租价</th>
														<th>最少提前（天）</th>
														<th>最多提前（天）</th>
													</tr>
													<tr>
														<td>用户需起租的最小周期</td>
														<td>用户可起租的最大周期</td>
														<td>优惠前的租赁价格</td>
														<td>优惠后的租赁价格</td>
														<td>续租价格</td>
														<td>用户最少在起租日前多少天可以下单租赁</td>
														<td>用户最多在起租日前多少天可以下单租赁</td>
													</tr>
												</table>
											</div>
										</div>
									</div>
			
									<!-- 颜色循环 -->
									<template v-for="item,index in typedata">
											<!-- 规格循环 -->
											<!-- 只有规格 -->
											
											<!-- 正常 -->
													<template v-for="ite,inde in item.children">
															<div class="te goods_price_check">
																	<!-- 商品定价信息列表渲染 -->
																	<div class="update_goodsColorSize">
																		<table class="table table-border table-bg  table-bordered">
																			<tr class="text-c text-cs">
																				<td width="240px;">颜色</td>
																				<td width="240px;">规格</td>
																				<td><i class="update_red">*</i>市场价</td>
																				<td><i class="update_red">*</i>押金</td>
																			</tr>
																			<tr class="text-c">
																				<!-- 双向绑定颜色和规格 -->
																				<td width="240px;">
																					<input type="text" v-model="item.color" class="update_goodsPriceRead"  readonly="readonly"   />
																				</td>
																				<td width="240px;">
																					<input type="add" v-model="ite.size" class="update_goodsPriceRead" readonly="readonly"   />
																				</td>
																				<td>
																					<input name="market_price[]"  v-model="ite.price" min="0" type="number" class="input-text radius size-M" style="width: 80px;"> /元
																				</td>
																				<td>
																					<template v-if="nodosite==1">
																						<input name="goods_deposit[]" readonly="readonly"  v-bind:value="0" min="0" type="number" class="input-text radius size-M" style="width: 80px;"> /元
																					</template>
																					<template v-else>
																						<input name="goods_deposit[]" v-model="ite.deposit" min="0" type="number" class="input-text radius size-M" style="width: 80px;"> /元
																					</template>
																				</td>
																			</tr>
																		</table>
																	</div>
																	  <!-- 时间点的循环 -->
																	
																			<div class="update_goodsMesSet">
																					<template v-for="it,ind in ite.children">
																					<table class="table table-list  table-border table-bg  table-bordered">
																						<tr class="text-c text-cs">
																							<td>最小租用周期</td>
																							<td>最大租用周期</td>
																							<td>现租价</td>
																							<!-- <td v-show="good_act_rate!=0">活动价</td> -->
																							<td>最少提前</td>
																							<td>最多提前</td>
																							<td>续租折扣</td>
																							<td>续租价格</td>
																						</tr>
																						<tr class="text-c tr-te1" style="font-size: 14px;height: 60px;">
																							<td>
																								<input name="rent_period_min_rent[]" min="0" v-model="it.children.min_rent" type="number" class="input-text radius size-M" style="width: 60px;height: 24px;">/{{it.time}}
																							</td>
																							<td style="position: relative;">
																							<div class="td-hide" v-show="it.children.max_rent>=0">
																									<input name="rent_period_max_rent[]" v-model="it.children.max_rent" min="0"  type="number" class="input-text radius size-M" style="width: 60px;height: 24px;">/{{it.time}}
																									<p class="td-p" @click="maxcheck(it.children);" style="border:1px solid #ccc;width: 80px;margin:5px auto;cursor: pointer;border-radius:5px;">无限期</p>
																								</div>
																								<div class="td-show" v-show="it.children.max_rent<0" style="margin:0 auto;width:70px;border-radius:5px;">
																									<p style="color: #333;font-size: 13px;">无限期</p>
																									<span class="td-click" @click="maxcheck(it.children);" style="font-size: 13px;cursor: pointer;color:  #2196f3;">点击取消</span>
																								</div>
																							</td>
																							<td>
																								<input min="0" name="rent_period_now_rent_price[]" v-model="it.children.currentprice" type="number" class="input-text radius size-M" style="width: 60px;height: 24px;">元/{{it.time}}</td>
																								<!-- <td v-show="good_act_rate!=0">
																									<input min="0" readonly name="rent_period_old_rent_price[]" :value="(it.children.currentprice*(good_act_rate/100)).toFixed(2)" type="number" class="input-text radius size-M" style="width: 60px;height: 24px;">元/{{it.time}}</td> -->
																								<td>
																								<input min="0" name="rent_period_min_advance[]" v-model="it.children.min_advance"  type="number" class="input-text radius size-M" style="width: 60px;height: 24px;">/日</td>
																							<td>
																								<select name="rent_period_max_advance[]" v-model="it.children.max_advance"  id="" style="border-radius: 4px;height: 26px;">
																									<option value="1">1个月</option>
																									<option value="2">2个月</option>
																									<option value="3">3个月</option>
																									<option value="4">4个月</option>
																									<option value="5">5个月</option>
																									<option value="6">6个月</option>
																									<option value="7">7个月</option>
																									<option value="8">8个月</option>
																									<option value="9">9个月</option>
																									<option value="10">10个月</option>
																									<option value="11">11个月</option>
																									<option value="12">12个月</option>
																							</select>
																						</td>
																						<td>
																							<input min="0" max="100" @blur="percent(it.children)" name="relet_discount[]" v-model="it.children.relet_discount"  type="number" class="input-text radius size-M" style="width: 60px;height: 24px;">/%
																							</td>
																						<td>
																							<input min="0" readonly="readonly"   :value="it.children.currentprice*it.children.relet_discount/100"  type="number" class="input-text radius size-M" style="width: 65px;height: 24px;">/元
																						</td>
																						</tr>
																					</table>
																				</template>
																				<p v-show="index != 0 || inde!=0" class="copydata"><button @click="copydata(index,inde)" type="button">复制数据</button> 复制数据功能可以将第一表格数据复制到本表格</p>
																				
																					<div class="tab-list cl" style="margin-top: 20px;">
																					</div>
																				</div>
																</div>
															
													</template>
									</template>
									
								</div>
							</div>
			
							<!-- SKU图片操作区域块 -->
							<div class="lab cl">
								<div class="lab-l">SKU图片</div>
								<p class="update_goodsCommonMess">SKU图片比例为1：1，建议尺寸800x800像素,支持png、jpg、gif等基本图片格式，图片小于2M</p>
								<div class="update_goodsSku">
									<p>请选择需要添加图片的SKU属性</p>
									<div id="tab_demo">
										<div class="tabBar clearfix">
											<span style="width: 60px;">颜色</span><span style="width: 60px;">规格</span></div>
										<div class="tabCon">
											<ul class="tabc-list cl tab1">
													<template v-for="item in typelist[0]">
													<template v-if="item.size">	
													<li  class="f-l" style="margin:0 15px 10px 0;width: 150px;">
															<div style="width: 150px;">
																<input type="hidden" value=""  name="goods_sku_img[]">
																<img class="upload_image skuupload" width="150px" height="150px" src="/static/www/merchant/style/img/upload.png" alt="添加图片">
																<input type="text" class="input-text radius size-M" name="goods_sku_attr_value[]" readonly="readonly" style="margin-top:10px;width: 100%;" v-model="item.size">
															</div>
														</li>
													</template>
												</template>
											</ul>
										</div>
										<button type="button" id="skuuploadbtn"  style="display:none"></button>
										<div class="tabCon">
											<ul  class="tabc-list cl tab2">
												<template v-for="item in typelist[1]">
													<template v-if="item.size">
														<li  class="f-l" style="margin:0 15px 10px 0;width: 150px;">
																<div style="width: 150px;">
																	<input type="hidden" value=""  name="goods_sku_img[]">
																	<img class="upload_image skuupload" alt="添加图片" width="150px" height="150px" src="/static/www/merchant/style/img/upload.png">
																	<input type="text" class="input-text radius size-M" style="margin-top:10px;width:100%;" name="goods_sku_attr_value[]" readonly="readonly" v-model="item.size">
																</div>
														</li>
													</template>
											</template>
											</ul>
										</div>
										<p class="update_goodsCommonMess" style="padding-left:0">目前只支持为其中一个商品规格设置不同的规格图片,设置后，用户选择不同规格会显示不同图片</p>
									</div>
								</div>
							</div>
						</div>
			
			
				<!-- 租赁清单区域块 -->
				<div class="lab cl">
					<div class="lab-l">租赁清单</div>
					<p class="update_goodsCommonMess">租赁清单图片比例为1：1，建议尺寸800x800像素,支持png、jpg、gif等基本图片格式，图片小于2M</p>

					<div class="lab-r cl update_goodsCommonR" style="position: relative;">
							<ul class="goods_lease_list img_upload_list">
						<?php
							 $goodsrentlistcount=count($goodsrentlist);
							for($i=0;$i<$goodsrentlistcount;$i++)
							{
								echo '<li class="goods_lease_single img_upload_single">
									<img class="upload_image" src="'.$goodsrentlist[$i]['imgURL'].'" data-url="'.$goodsrentlist[$i]['goods_rentlist_img'].'">
									<input placeholder="请输入名称" value="'.$goodsrentlist[$i]['goods_rentlist_name'].'"  class="goods_lease_mess" type="text" >
									<a href="javascript:" class="upload_delete" title="删除" data-index="0">x</a>
								</li>';
							}
							
							?>
						</ul>
						<button type="button" style="display:none" id="hidden_lease"></button>
						<label class="goods_lease_add" id="goods_lease_add">添加清单</label>
						<!-- 数据隐藏域； -->
						<input id="id_file_rents" type="hidden" name="file_rents" />
					</div>
				</div>
				<!-- 租赁清单区域块 -->

				<!-- 商品主图区域块 -->
				<div class="lab cl">
					<div class="lab-l"><i class="update_red">*</i>商品主图</div>
					<p class="update_goodsCommonMess">首张图片为主图（商品主图图片比例为1：1，建议尺寸：800x800像素，支持png、jpg、gif等基本图片格式，图片小于2M）</p>

					<div class="lab-r update_goodsCommonR" style="position: relative;padding-bottom:0">

						<ul class="goods_mainimg_list img_upload_list">
								
							<?php
								        $maincount=count($goodsmainimg);
								    	for($i=0;$i<$maincount   ;$i++)
										 {
										 $mpic='mainPic'.$i;
										 $imgs='img'.$i;
										 echo ' 
										 <li class="img_upload_single">
											 <img class="upload_image" data-url="'.$goodsmainimg[$i]['goods_main_pic'].'" src="GOODS_MAIN_PATH/'.$goodsmainimg[$i]['goods_main_pic'].'">
											 <a href="javascript:" class="upload_delete" title="删除" data-index="0">x</a>
											</li>
										';
									}
								 
								 ?>
								 <li class="goods_mainimg_add img_upload_single">
										<img class="upload_image">
										<!-- <a href="javascript:" class="upload_delete" title="删除" data-index="0">x</a> -->
								</li>
								<button type="button" style="display:none" id="hidden_imgmain"></button>
								<input id="id_file_mains" type="hidden" name="file_mains[]" />
								
								<!-- 数据隐藏域； -->
						</ul>
					</div>
				</div>
				<!-- 商品主图区域块 -->

				<!-- 租赁合约模板 -->
				<div class="lab cl">
					<div class="lab-l">租赁合约模板</div>
					<div class="lab-r" style="border:0;margin-top: 7px;">
						<span id="zulin">
								<select  name="goods_leasing_rules" id="se1">
								<option value="">请选择租赁规则/合约模板</option>
								<?php foreach($lease_tpl as $kzl => $vzl)
								{
								
								 if($vzl['leasing_rules_id']==$data['goods_leasing_rules'])
								 {
								  echo '<option selected="selected" value="'.$vzl['leasing_rules_id'].'">'.$vzl['leasing_rules_name'].'</option>';
								 }
								 else
								 {
								  echo '<option value="'.$vzl['leasing_rules_id'].'">'.$vzl['leasing_rules_name'].'</option>';
								 }
								 }
								?>
					            </select>
							</span>
							<span style="color:  #2196f3;margin-left: 7px;cursor: pointer;" class="sp1">刷新</span>
							<a href="{:url('leasingrules/create')}" target="_blank">新建租赁规则/合约模板</a>
					
					</div>
				</div>
				<!-- 租赁合约模板 -->

				<!-- 商品详情模板 -->
				<div class="lab cl" style="display:none">
					<div class="lab-l">商品详情模板</div>
					<div class="lab-r" style="border:0;">
						<span id="zulin2">
							<select  onchange="get_good_detail($(this).val());" name="goods_goods_detail_id" >
							<option value="">请选择商品详情模板</option>	
							  <?php
								   foreach($detail_tpl as $ksp => $vsp)
								   {
								    if($vsp['goods_details_id']==$data['goods_goods_detail_id'])
								    {
								     echo '<option selected="selected" value="'.$vsp['goods_details_id'].'">'.$vsp['goods_details_name'].'</option>';
								    }
								    else
								    {
								     echo '<option value="'.$vsp['goods_details_id'].'">'.$vsp['goods_details_name'].'</option>';
								    }
								    }
								   ?>
					        </select>
							</span>
							<span style="color:  #2196f3;margin-left: 7px;cursor: pointer;" class="sp2">刷新</span>
							<a href="{:url('goodsdetails/create')}" target="_blank">新建商品详情模板</a>
	
	
					</div>
				</div>
				<!-- 商品详情 -->
				<div class="lab cl">
					<div class="lab-l" style="position: relative;">
						<i class="update_red">*</i>商品详情
					</div>
					<p class="update_goodsCommonMess">图片建议宽为620像素，高度无限制，图片仅支持JPG、GIF、PNG格式，图片要小于1M</p>

					<div class="lab-r update_goodsCommonR" style="padding-bottom:0">

						<ul class="goods_more_list img_upload_list">
								
							<?php
							foreach($img_details as $kimg => $vimg)
							{
								echo '<li class="img_upload_single">
									<img class="upload_image" data-url="'.$vimg['image'].'" src="'.$vimg['imgUrl'].'">
									<a href="javascript:" class="upload_delete" title="删除" data-index="0">x</a>
								</li>';
							}
							?>
							<li class="goods_more_add img_upload_single">
									<img class="upload_image">
									<!-- <a href="javascript:" class="upload_delete" title="删除" data-index="0">x</a> -->
								</li>
							<button type="button" style="display:none" id="hidden_more"></button>
							<!-- 数据隐藏域； -->
							<input type="hidden" value="" id="ipt_goods_details_images" name="goods_details_images">
					
						</ul>
					</div>
				</div>
				<div class="lab cl">
					<div class="lab-l"><i class="update_red">*</i>运费模板</div>
					<p class="update_goodsCommonMess">（至少选择一种模板）</p>

					<div class="lab-r update_goodsCommonR" style="padding: 20px;box-sizing: border-box;">
						<div>
							<span style="color: #444;">快递模板</span>
							<span id="zulin3">
								<select name="express_id" id="" >
								<option value="">请选择快递模板</option>
								 <?php
								   foreach($express_tpl as $kyf => $vyf)
								   {
								   
								    if($vyf['freight_id']==$kdmoban['goods_shipping_tpl_selected'])
								    {
								     echo '<option selected="selected" value="'.$vyf['freight_id'].'">'.$vyf['freight_name'].'</option>';
								    }
								    else
								    {
								     echo '<option value="'.$vyf['freight_id'].'">'.$vyf['freight_name'].'</option>';
								    }
								    }
								   ?>
								 </select>
								</span>
								<span id="id_kd" style="color:  #2196f3;margin-left: 7px;cursor: pointer;">刷新</span>
								
															<a href="{:url('freight/add')}" target="_blank">新建快递模板</a>
												
						</div>
						<div style="margin-top: 20px;">
							<span style="color: #444;">上门模板</span>
							<span id="zulin4">
								<select  name="todoor" id="" >
								<option value="0">请选择上门模板</option>
								 <?php
								   foreach($to_door as $ksm => $vsm)
								   {
								    if($vsm['freight_id']==$smmoban['goods_shipping_tpl_selected'])
								    {
								     echo '<option selected="selected"  value="'.$vsm['freight_id'].'">'.$vsm['freight_name'].'</option>';
								    }
								    else
								    {
								     echo '<option value="'.$vsm['freight_id'].'">'.$vsm['freight_name'].'</option>';
								    }
								    }
								   ?>
							     </select>
								</span>
								
							<span id="id_sm" style="color:  #2196f3;margin-left: 7px;cursor: pointer;">刷新</span>
							<a href="{:url('freight/homeservice')}" target="_blank">新建上门模板</a>
				
						</div>

						<div style="margin-top: 20px;">
							<span style="color: #444;;">自提点</span>
							<span style="color: #ddd;margin-left: 17px;">不选视为商品不可自提</span>
							<span style="margin-top:10px;">
									<div style="max-height:250px;overflow-y:auto;margin-top:10px;">

								<table  class="table table-border table-bg  table-bordered update_addressshop">
		 							<tr class="text-c first-tr">
					 					<td>门店名称</td>
					 					<td>门店地址</td>
										 <?php 
										 if(count($sinces)==count($ztmoban)){
											echo '<td><input class="checkAlls" checked="checked" type="checkbox"  style="margin-right:5px;">全选</td>';
											
										 }else{
											echo '<td><input class="checkAlls" type="checkbox"  style="margin-right:5px;">全选</td>';
											
										 }
										 
										 ?>

					  				</tr>
									 <?php
								   foreach($sinces as $ksi => $vsi)
								   {
								   
								       echo  '<tr  class="text-c">
					 					<td>'.$vsi['since_name'].'</td>
					 					<td style="width: 80px;">'.$vsi['since_detailed_address'].'</td>';
					 				   if(in_array($vsi['since_id'], $ztmoban))
										 
										   {
								         echo '<td><input checked="checked" class="inputd" name="since_id[]" value="'.$vsi['since_id'].'" type="checkbox" ></td>';
										 
										   }else
										   {
										echo '<td ><input class="inputd" name="since_id[]" value="'.$vsi['since_id'].'" type="checkbox" ></td>';
										
										   }
										 
										echo ' </tr>';
								    }
								   ?>
									</table>
						</div>
						
								</span>
						</div>

					</div>
				</div>
				<div class="lab cl">
						<div class="lab-l" style="width: 370px;"><i class="update_red">*</i>归还地址
							<a style="line-height:35px;margin-left:25px" href="javascript:void(0);" onclick="getretun_address()">刷新</a>
							<a target="view_window" href="{:url('revert/add')}">添加归还地址</a>
						</div>
					<div class="lab-r update_goodsCommonR" style="border:0;margin-top:10px">
					<div style="max-height:250px;overflow-y:auto;margin-top:10px;">
						<table class="table table-border table-bg  table-bordered update_addresschange">
							<tr class="text-c first-tr">
								<td>姓名</td>
								<td>收货地址</td>
								<?php 
								if(count($ghdz)==count($return_place)){
									echo '<td><input class="checkAll" checked="checked" type="checkbox"  style="margin-right:5px;">全选</td>';
										
									}else{
										echo '<td><input class="checkAll" type="checkbox"  style="margin-right:5px;">全选</td>';
									}
								?>

							</tr>
							<?php
								   foreach($return_place as $kgh => $vgh)
								   {
								   
								        echo  '<tr><td>'.$vgh['revent_receiver_name'].'</td>
		 							    <td>'.$vgh['revent_province'].$vgh['revent_city'].$vgh['revent_region'].$vgh['revent_detailed_address'].'</td>';
										
										if(in_array($vgh['revert_id'], $ghdz))
									       {
								        echo '<td><input type="checkbox"  checked="checked" class="input" name="goods_revert_id[]" value="'.$vgh['revert_id'].'"></td>';
										   }
										else
										   {
										echo '<td><input type="checkbox"  class="input" name="goods_revert_id[]" value="'.$vgh['revert_id'].'">
										</td>';
										   }
										 
										echo ' </tr>';
								    }
								   ?>
						</table>
					</div>
				</div>
				</div>
				<div class="lab cl">
					<div class="lab-l"><i class="update_red">*</i>是否需要实名认证</div>
					<div class="lab-r" style="border:0;margin-top: 10px;">
						<?php
						  if($data['goods_is_verify_real_name']==1)
						  {
							echo '<input type="radio"  checked="checked" name="goods_is_verify_real_name" value="1" style="margin-right:5px;">是';	
						 	echo '<input type="radio"   name="goods_is_verify_real_name" value="2"  style="margin-left: 20px;margin-right:5px;">否';	
						  }
						  else
						  {
						    echo '<input type="radio"  name="goods_is_verify_real_name" value="1" style="margin-right:5px;">是';	
						 	echo '<input type="radio"  name="goods_is_verify_real_name" value="2" checked="checked" style="margin-left: 20px;margin-right:5px;">否';	
						  }
						  ?>
					</div>
				</div>
				<div class="mac">
					<?php  
							if ($goodsdata['goods_shelf_state']==1)
							{
							echo '<input type="button" value="上架" class="btn"  onclick="updategoods1();">';
							echo '<input type="button" value="保存" class="btn"  onclick="updategoods2();">';
							} elseif ($goodsdata['goods_shelf_state']==3)
							{
							echo '<input type="button" value="上架" class="btn"  onclick="updategoods1();">';
							echo '<input type="button" value="保存" class="btn"  onclick="updategoods3();">';
							} else
							{
							echo '<input type="button" value="上架" class="btn"  onclick="updategoods1();">';
							}
							?>
							<input type="button" value="返回" class="btn"  onclick="window.history.go(-1);">
				</div>
			</div>
		</form>
	</div>
	<div class="modal inmodal fade" id="portocol" tabindex="-1" role="dialog" id="div_main1" style="display: none;margin-top: -100px;margin-left: 140px;">
		<div onclick="hidedetails()" id="div_main1" class="modal-body" style="position:absolute;z-index:99;font-size: 16px;width:1000px; height:600px; overflow-y: scroll;background-color:white;">

		</div>
	</div>

	<script type="text/javascript">
	/* 页面数据 */
	var zhekou=JSON.parse('<?php echo json_encode($good_act_rate,true);?>')
	var htmltypedata=JSON.parse('<?php echo json_encode($rent_type_list,true);?>');
	var skuimgurl='GOODS_SKU_PATH';
	var skuimglist= JSON.parse('<?php echo json_encode($goodssku);?>');
	
	/* 页面数据 */
var uploadurl="{:url('goods/uploadImg')}";
function putdowngoods(id) {
			layer.msg('你确定要下架吗？', {
				time: 0,
				btn: ['确定', '取消'],
				area: ['250px', '120px'],
				btnAlign: 'c',
				yes: function (index) {
					layer.close(index);
					$.ajax({
						type: 'get',
						url: "<?php echo url('goods/goods_putdown', '', false); ?>/goods_id/" + id,
						dataType: 'json',
						success: function (data) {
							if (data.status == 1) {
								layer.msg(data.msg, {
									offset: 't',
									anim: 5,
									success: function () {
										location.href = "{:url('goods/showlist')}";
									}
								});
							}

						}
					});
				}
			});

		}
		$("#span_namecount").html($("#goods_name").val().length + '/30');
function getretun_address(){
	$.ajax({
				type: "get",
				url: "{:url('revert/getRevert')}",
				dataType: 'json',
				cache: false,
				success: function (data) {
					data=data.data;
					console.log(data);
					var firsttr='<tr class="text-c first-tr"><td>姓名</td><td>收货地址</td><td><input class="checkAll" type="checkbox" style="margin-right:5px;">全选</td></tr>';
					var lasttr="";
					for (var i = 0; i < data.length; i++) {
						lasttr+='<tr class="text-c"><td>'+data[i].revert_name+'</td><td>'+data[i].revent_address+'</td><td><input type="checkbox" class="input" id="ipt_revert" name="goods_revert_id[]" value='+data[i].revert_id+'></td></tr>';
					}
					firsttr+=lasttr;
					$(".update_addresschange").html("");
					$(".update_addresschange").append(firsttr);
				},
				error: function (xhr, status, error) {
					
				}
			});	
}
									
		function readCookie(name) {
			var cookieValue = "";
			var search = name + "=";
			if (document.cookie.length > 0) {
				offset = document.cookie.indexOf(search);
				if (offset != -1) {
					offset += search.length;
					end = document.cookie.indexOf(";", offset);
					if (end == -1)
						end = document.cookie.length;
					cookieValue = unescape(document.cookie.substring(offset, end))
				}
			}
			return cookieValue;
		}

		function writeCookie(name, value, hours) {
			var expire = "";
			if (hours != null) {
				expire = new Date((new Date()).getTime() + hours * 3600000);
				expire = "; expires=" + expire.toGMTString();
			}
			document.cookie = name + "=" + escape(value) + expire;
		}
		$('#sort1').on('click', function () {
			$('#sort2').show();
			$('#sort3').hide();
		})
		$('#sort1').children('li').on('click', function () {
			$(this).addClass('actives').siblings().removeClass('actives');
			var value1 = $(this).html();
			$('.s1').html(value1);
		})
		$('#sort2').on('click', function () {
			$('#sort3').show();
		})
	</script>
	<script type="text/javascript" src="__MERCHANT_STATIC__/style/js/updata.js"></script>
	
	<script type="text/javascript">
		//级联查询商品类目

		
		
		function findChild(catId, obj) {
			$.ajax({
				type: "get",
				url: "<?php echo url('goodscategory/childs', '', false); ?>/catId/" + catId,
				dataType: 'json',
				cache: false,
				success: function (data) {
					var str = '';
					if (data.status == 1) {
						$(data.data).each(function (k, v) {
							str += '<li onclick="findSubChild(' + v.goods_category_id + ',this)">' + v.goods_category_name + '</li>';
						});
						$('#sort2').html(str);


						$('#sort2').children('li').on('click', function () {
							$(this).addClass('actives').siblings().removeClass('actives');
							var value2 = $(this).html();
							$('.s2').html(value2);
						})
						$("#span_catname").html($(obj).prop("innerHTML"));
					} else {
						layer.msg(data.msg);
					}

				},
				error: function (xhr, status, error) {
					console.log(xhr);
					console.log(status);
					console.log(error);
				}
			});
		}



		function findSubChild(catId, obj) {
			$.ajax({
				type: "get",
				url: "<?php echo url('goodscategory/childs', '', false); ?>/catId/" + catId,
				dataType: 'json',
				cache: false,

				success: function (data) {
					var str = '';
					var stu = [];
					if (data.status == 1) {
						$(data.data).each(function (k, v) {
							str += '<li onclick="setCateText(this)">' + v.goods_category_name + '</li>';
							stu.push(v.goods_category_id);
						});
						$('#sort3').html(str);

						$('#sort3').children('li').on('click', function () {
							$(this).addClass('actives').siblings().removeClass('actives');
							var value3 = $(this).html();
							$('.s3').html(value3);
							var num = $(this).index();
							var id = stu[num];
							writeCookie("id", id);
							$("input[name='goods_category_id']").val(id);
						})
						$("#span_catname").html($('#sort1 li.actives').prop("innerHTML") + '/' + $(obj).prop("innerHTML").split("/")[0]);
					} else {
						layer.msg(data.msg);
					}

				},
				error: function (xhr, status, error) {
					console.log(xhr);
					console.log(status);
					console.log(error);
				}
			});
		}

		function setCateText(obj) {
			$("#span_catname").html($('#sort1 li.actives').prop("innerHTML") + '/' + $('#sort2 li.actives').prop("innerHTML").split(
				"/")[0] + '/' + $(obj).prop("innerHTML"));
			$("#div_cate").hide();
		}

		function setDiv_Cate() {
			$("#div_cate").show();
		}
	</script>




	<script type="text/javascript">
		var num = 0;

		function append(goodsId) {
			var arr = [];
			var len = $('.checkall>input:checked').length;
			alert(len);
			for (i = 0; i < len; i++) {
				var name_id = $('input[type=checkbox]').eq(i).val();
				arr.push(name_id);
			}
		}

		function getGoodsDetails(detailsId) {
			$.ajax({
				type: "get",
				url: "{:url('goods/goodsDetail', '', false)}/detailsId/" + detailsId,
				dataType: 'json',
				success: function (data) {

					if (data.status == 1) {
						$('.edui-body-container').html(data.data.goods_details_content);
					}
				}
			});
		}


		





		$('.update_addresschange').on('click','.checkAll',function () {
			//$("#ipt_revert").val("");
			if ($('.checkAll').prop('checked')) {
				$('.input').prop('checked', true);
			} else {
				$('.input').prop('checked', false);
			}
		});
		$('.checkAlls').on('click', function () {
			//$("#ipt_since").val("");
			if ($('.checkAlls').prop('checked')) {
				$('.inputd').prop('checked', true);
			} else {
				$('.inputd').prop('checked', false);
			}
		});
		var $input = $('.input').not('.checkAll');
		$input.on('change', function () {
			if ($('.input:checked').not('.checkAll').length == $input.size()) {
				$('.checkAll').prop('checked', true);
			} else {
				$('.checkAll').prop('checked', false);
			}
		});

		function modaldemo() {
			//$("#modal-demo").modal("show");
		}
		$(function () {
			$.Huitab("#tab_demo .tabBar span", "#tab_demo .tabCon", "current", "click", "0")
		});



		/******************表单验证操作******************/
		/**
		1.商品类目不得为空
		2.商品名称不得为空且不能超过30字 
		3.每笔限租为50（1-50，可以为空）reg = /^[1-9]\d*$/;
		4.市场价为正数  var reg = /^\d+(\.\d{1,2})?$/;
		5.押金为正整数 var reg = /^\d+(\.\d{1,2})?$/;
		6.最小租用周期为正整数 reg = /^[1-9]\d*$/;
		7.最大租用周期为正整数，且最大租用周期必须大于等最小租用周期  reg = /^[1-9]\d*$/;
		8.原租价和现租价均为正数 大于0即可，原租价大于先租价 var reg = /^\d+(\.\d{1,2})?$/; 
		9.最少提前为正整数 reg = /^[1-9]\d*$/；
		10.规格不能相同，颜色和颜色，大小和大小
		*****/
		//最终提交验证
		function checktosave() {
			//验证类目
			if ($("#span_catname").prop("innerHTML") == "") {
				layer.msg("类目不能为空!");
				$(".Hui-article-box").scrollTop(0)
				return false;
			}
			 
			//验证商品
			if ($("#goods_name").val() == '') {
				layer.msg("商品名称不能为空!");
				$("#goods_name").focus();
				return false;
			}
			//验证租用周期
			if ($(".btn-success").length == 0) {
				layer.msg("请选择租用周期!");
				//滚动到对应租用周期选择区域
				$(".Hui-article-box").scrollTop(300);
				return false;
			}
			//验证市场价
			var market_price_bool = "";
			$("input[name='market_price[]']").each(
				function () {
					var reg = /^\d+(\.\d{1,2})?$/;
					if (!reg.test($(this).val()) || $(this).val() <= 0) {
						$(this).focus();
						market_price_bool = "市场价只能为大于0的正数，保留两位小数";
						return false;

					}
				});

			if (market_price_bool != "") {
				layer.msg(market_price_bool);
				return false;
			}
			//验证押金
			var goods_is_free_deposit_bool = "";
			if (!$("input[name='goods_is_free_deposit']").prop("checked")) {
				$("input[name='goods_deposit[]']").each(
					function () {
						var reg = /^\d+(\.\d{1,2})?$/;
						if (!reg.test($(this).val())) {
							$(this).focus();
							goods_is_free_deposit_bool = "押金只能为大于等于0的正数，保留两位小数";
							return false;
						}
					});
			}
			if (goods_is_free_deposit_bool != "") {
				layer.msg(goods_is_free_deposit_bool);
				return false;
			}


			//验证最小租用周期
			var rent_period_min_rent_bool = "";
			$("input[name='rent_period_min_rent[]']").each(
				function () {
					var self = $(this);
					var reg = /^[1-9]\d*$/;
					var afterDom = self
                        .parents("td")
                        .next("td");
					if (!reg.test($(this).val())) {
						$(this).focus();
						rent_period_min_rent_bool = "最小租用周期只能为大于0的正整数";
						return false;

					}
					if (afterDom.find(".td-hide").css("display") !== "none") {
                        var maxdate = afterDom
                            .find("input[name='rent_period_max_rent[]']")
                            .val() - 0;
                        if ((self.val() - 0) > maxdate) {
							$(this).focus();
                            rent_period_min_rent_bool = "最小租期不得大于最大租期";
							return false;
                            /* layer.msg("最小租期不得大于最大租期"); */
                        }
                    }

				}
			);
			if (rent_period_min_rent_bool != "") {
				layer.msg(rent_period_min_rent_bool);
				return false;
			}
			
			//验证最大租用周期
			var rent_period_max_rent_bool = "";
			$("input[name='rent_period_max_rent[]']").each(
				function () {
					var reg = /^[1-9]\d*$/;
					if ($(this).parent().css("display") != 'none' && !reg.test($(this).val())) {
						$(this).focus();
						rent_period_max_rent_bool = "最大租用周期只能为大于0的正整数";
						return false;

					}
				}
			);
			if (rent_period_max_rent_bool != "") {
				layer.msg(rent_period_max_rent_bool);
				return false;
			}

			//验证原租价
			/* var rent_period_old_rent_price_bool = "";
			$("input[name='rent_period_old_rent_price[]']").each(
				function () {
					var self = $(this);
                    var afterDom = self
                        .parents("td")
                        .next("td");
                    var reg = /^\d+(\.\d{1,2})?$/;
                    if (!reg.test($(this).val() - 0) || ($(this).val() - 0) <= 0) {
						self.focus();
						rent_period_old_rent_price_bool='原租价只能为大于0的正数，保留两位小数';
                        return false;
                    }
                    var maxdate = afterDom
                        .find("input[name='rent_period_now_rent_price[]']")
                        .val() - 0;
                    if ((self.val() - 0) < maxdate && maxdate !== "") {
						self.focus();
						rent_period_old_rent_price_bool="原租价不得小于现租价";
						return false;
                    }
				}
			);
			if (rent_period_old_rent_price_bool != "") {
				layer.msg(rent_period_old_rent_price_bool);
				return false;
			} */

			//验证现租价
			var rent_period_now_rent_price_bool = "";
			$("input[name='rent_period_now_rent_price[]']").each(
				function () {
					var self = $(this);
					var reg = /^\d+(\.\d{1,2})?$/;
					if (!reg.test($(this).val() - 0) || ($(this).val() - 0) <= 0) {

						$(this).focus();
						rent_period_now_rent_price_bool = "现租价只能为大于0的正数，保留两位小数!";
						return false;
					}
				}
			);
			if (rent_period_now_rent_price_bool != "") {
				layer.msg(rent_period_now_rent_price_bool);
				return false;
			}

			//最少提前日期不能为空或0!
			var rent_period_min_advance_bool = "";
			$("input[name='rent_period_min_advance[]']").each(
				function () {
					var self = $(this);
					var reg = /^[1-9]\d*$/;
					if (!reg.test($(this).val() - 0)) {
						$(this).focus();
						rent_period_min_advance_bool = "最少提前只能为大于0的正整数!";
						return false;
					}
				}
			);
			if (rent_period_min_advance_bool != "") {
				layer.msg(rent_period_min_advance_bool);
				return false;
			}

			var since_id_bool = false;
			$("input[name='since_id[]']").each(
				function () {
					if ($(this).prop("checked")) {
						since_id_bool = true;
					}
				}
			);

			//判断是否有运费模板	 
			if ($("select[name='express_id']").val() == "" && $("select[name='todoor']").val() == "" && !since_id_bool) {
				layer.msg("至少选择一种运费模板!");
				return false;
			}

			//判断服务标-上门
			if ($("input[name='goods_is_door']").prop("checked") && $("select[name='todoor']").text() == "请选择上门模板") {
				layer.msg("服务标-上门 至少选一个上门模板!");
				return false;
			}
			//判断服务标-自提
			if ($("input[name='goods_is_since']").prop("checked") && !since_id_bool) {
				layer.msg("选择了服务标-自提 至少选一个自提点!");
				return false;
			}
			//判断归还地址
			var goods_revert_id_bool = false;
			$("input[name='goods_revert_id[]']").each(
				function () {
					if ($(this).prop("checked")) {
						goods_revert_id_bool = true;
						return false;
					}
				}
			);

			if (!goods_revert_id_bool) {
				layer.msg("归还地址不能为空!");
				return false;
			}
			return true;
		}

		//失去焦点是的表单验证

		
		function updategoods1() {
			//表单验证，信息最终提交
			vue_app.vue_dataup();
			if (!checktosave()) {
				return false;
			}
			if (!goods_lease_formUpload()) {
				layer.alert("请补全租赁清单图片和标题");
				return false;
			}
			if (!goods_mainimg_formUpload()) {
				layer.alert("商品主图不能为空");
				return false;
			}
			if (!goods_more_formUpload()) {
				layer.alert("商品详情不能为空");
				return false;
			}

			$.ajax({

				type: "POST",
				url: "{:url('goods/updategoods1', '', false)}",
				dataType: 'json',
				cache: false,
				data: $('#frm').serialize(),
				success: function (data) {
					if (data.status == 1) {
						layer.msg(data.msg);

						location.href = "{:url('goods/showlist')}";

					} else {
						layer.msg(data.msg);
					}

				},
				error: function (xhr, status, error) {
					console.log(xhr);
					console.log(status);
					console.log(error);
				}
			});

		}

		function updategoods2() {
			//表单验证，信息最终提交
			vue_app.vue_dataup();
			if (!checktosave()) {
				return false;
			}
			if (!goods_lease_formUpload()) {
				layer.alert("请补全租赁清单图片和标题");
				return false;
			}
			if (!goods_mainimg_formUpload()) {
				layer.alert("商品主图不能为空");
				return false;
			}
			if (!goods_more_formUpload()) {
				layer.alert("商品详情不能为空");
				return false;
			}

			$.ajax({

				type: "POST",
				url: "{:url('goods/updategoods2', '', false)}",
				dataType: 'json',
				cache: false,
				data: $('#frm').serialize(),
				success: function (data) {
					if (data.status == 1) {
						layer.msg(data.msg);

						location.href = "{:url('goods/showlist')}";
					} else {
						layer.msg(data.msg);
					}

				},
				error: function (xhr, status, error) {
					console.log(xhr);
					console.log(status);
					console.log(error);
				}
			});

		}

		function updategoods3() {
			//表单验证，信息最终提交
			vue_app.vue_dataup();
			if (!checktosave()) {
				return false;
			}
			if (!goods_lease_formUpload()) {
				layer.alert("请补全租赁清单图片和标题");
				return false;
			}
			if (!goods_mainimg_formUpload()) {
				layer.alert("商品主图不能为空");
				return false;
			}
			if (!goods_more_formUpload()) {
				layer.alert("商品详情不能为空");
				return false;
			}

			$.ajax({

				type: "POST",
				url: "{:url('goods/updategoods3', '', false)}",
				dataType: 'json',
				cache: false,
				data: $('#frm').serialize(),
				success: function (data) {
					if (data.status == 1) {
						layer.msg(data.msg);

						location.href = "{:url('goods/showlist')}";
					} else {
						layer.msg(data.msg);
					}

				},
				error: function (xhr, status, error) {
					console.log(xhr);
					console.log(status);
					console.log(error);
				}
			});

		}

		window.onload=function () {
		 
		 
	}
	
		$('.inp-te').on('blur', function () {
			var valued = $('.inp-te').val();
			var numbers = valued.split('');
			console.log(numbers)
			if (numbers.length >= 30) {
				$('.err').html('请不输入超过30个字');
			}
		});
		function kdmb(merchant_id){
		$.ajax({
			type:'post',
			url:"{:url('goods/refresh_kd', '', false)}",
			success:function(data){
				if(data.status == 1)
				{
			        var str = '<select  name="express_id" id=""><option value="">请选择快递模板</option>';
					$(data.data).each(function(k, v){
						str += '<option value="'+v.freight_id+'">'+v.freight_name+'</option>';
					});
					str += '</select>';
					$('#zulin3').html(str);
					 
				}
			}
		})
	};	
	
function smmb(merchant_id){
		$.ajax({
			type:'post',
			url:"{:url('goods/refresh_sm', '', false)}",
			success:function(data){
				if(data.status == 1)
				{
				    var str = '<select  name="todoor" id=""><option value="">请选择上门模板</option>';
					$(data.data).each(function(k, v){
						str += '<option value="'+v.freight_id+'">'+v.freight_name+'</option>';
					});
					str += '</select>';
					$('#zulin4').html(str);
					 
				}
			}
		})
	};	
	function zuyue(merchant_id){
			$.ajax({
				type:'post',
				url:"{:url('leasingrules/refresh', '', false)}/merchant_id/"+ merchant_id,
				success:function(data){
					if(data.status == 1)
					{
						var str = '<select name="goods_leasing_rules" id="se1"><option value="">请选择租赁规则/合约模板</option>';
						$(data.data).each(function(k, v){
							str += '<option value="'+v.leasing_rules_id+'">'+v.leasing_rules_name+'</option>';
						});
						str += '</select>';
						$('#zulin').html(str);
						 
					}
				},
				error:function(){
				}
			})
		};
		$('#id_kd').on('click',function(){
			kdmb({:session('merchant.merchant_id')});
		});
		$('#id_sm').on('click',function(){
			smmb({:session('merchant.merchant_id')});
		});
		$('.sp1').on('click',function(){
			zuyue({:session('merchant.merchant_id')});
		});
		$('.sp2').on('click',function(){
			moban({:session('merchant.merchant_id')});
		})
		
		//"{:session('merchant.merchant_id')}"
		function moban(merchant_id){
			$.ajax({
				type:'post',
				url:"{:url('goodsdetails/refresh', '', false)}/merchant_id/"+ merchant_id,
				success:function(data){
					if(data.status == 1)
					{
						var str = '<select onchange="get_good_detail($(this).val());" name="goods_goods_detail_id" id="se1"><option value="">请选择商品详情模板</option>';
						$(data.data).each(function(k, v){
							str += '<option value="'+v.goods_details_id+'">'+v.goods_details_name+'</option>';
						});
						str += '</select>';
						$('#zulin2').html(str);
						 
					}
				}
			})
		};
	
		$(function () {
			$.Huitab("#tab_demo .tabBar span", "#tab_demo .tabCon", "current", "click", "0")
		});

		// 参数说明点击切换和显示
		$('.can').on('click', function () {
			if ($('.update_goodsPrames').is(":hidden")) {
				$('.update_goodsPrames').fadeIn();
				$('.can').text("隐藏参数说明");
			} else {
				$('.update_goodsPrames').fadeOut();
				$('.can').text("显示参数说明");
			}
		})

		function qingdan(obj) {
			$(obj).siblings().show();
			$(obj).hide();
		}
		

		function tpClick(obj) {
			$(obj).parent('.td-hide').hide();
			$(obj).parent('.td-hide').siblings('.td-show').show();
		}

		function inputShow(obj) {
			$(obj).siblings().show();
		}

		function liShow(obj) {
			var tw = $(obj).val();
			if (tw == '') {
				$(obj).siblings().show();
				$(obj).hide();
			} else {
				$(obj).hide();
				$(obj).parent('.tab-list').siblings().find('.tr-te').first().children().val(tw);
			}
		}
	

		function dellist(obj) {
			$(obj).parent().remove();
			add();
			$('.box2').hide();
		}
	
		var arr = [];
		var dx = arr.length + 1;


	


		function get_good_detail(DetailId) {
			var formData = new FormData();
			formData.append("goods_details_id", DetailId);
			$.ajax({
				type: "post",
				url: "{:url('goods/getGoodsDetails', '', false)}",
				async: true,
				cache: false,
				data: formData,
				processData: false,
				contentType: false,
				success: function (res) {

					$("#goods_details_image").attr("src", res.data['url']);
					$("#ipt_goods_details_image").val(res.data['img']);
					$("#ipt_details").val(res.data['name']);

				},
				error: function (res) {

					console.log(res.access_url);
				}
			});
		}

		function upload_goods_details(img_id) {
			var formData = new FormData();
			formData.append("file", $("#" + img_id + "")[0].files[0]);
			$.ajax({
				type: "post",
				url: "{:url('Goodsdetails/upload_img', '', false)}",
				async: true,
				cache: false,
				data: formData,
				processData: false,
				contentType: false,
				data: formData,
				success: function (res) {
					$("#" + img_id + "").siblings("img").attr("src", res.data.access_url);
					$("#" + img_id + "").siblings("img").siblings("input[type=hidden]").val(res.data.filename);
				},
				error: function (res) {
					console.log(res.access_url);

				}
			});
		}
		//判断商品名称长度
		function checkcount() {
			if ($("#goods_name").val().length > 30) {
				layer.msg("商品名称长度不能超过30!");
				$("#goods_name").val($("#goods_name").val().substr(0, 30));
				return;
			}
			$("#span_namecount").html($("#goods_name").val().length + '/30')
		}

		
	
	</script>
	<script language="javascript" type="text/javascript">
		$(document).ready(function(){
		  // 免押金
		  if(<?php echo  $goodsdata['goods_is_free_deposit'] ?>=="1")
		  {
			$("input[name=goods_is_free_deposit]").prop("checked", true);
		  }
		  //  包邮
		  if(<?php echo  $goodsdata['goods_is_free_shipping'] ?>=="1")
		  {
		  $("input[name=goods_is_free_shipping]").prop("checked", true);
		  }
		  //  免赔
		  if(<?php echo  $goodsdata['goods_is_deductible'] ?>=="1")
		  {
		  $("input[name=goods_is_deductible]").prop("checked", true);
		  }
		  //   上门
		  if(<?php echo  $goodsdata['goods_is_door'] ?>=="1")
		  {
		   $("input[name=goods_is_door]").prop("checked", true);
		  }
		  //   自提
		  if(<?php echo  $goodsdata['goods_is_since'] ?>=="1")
		  {
		   $("input[name=goods_is_since]").prop("checked", true);
		  }
		  // 随租随还
		  if(<?php echo  $goodsdata['goods_is_follow_lease'] ?>=="1")
		  {
		   $("input[name=goods_is_follow_lease]").prop("checked", true);
		  }
		  //周期
		  
		  
			
		  
	   });
	   </script>
	<script language="javascript" type="text/javascript">
		function showdetails() {
			var vv = $('#div_main').prop("innerHTML");

			var vgoods_name = $("#goods_name").val();

			var vcatName = $("#span_catname").prop("innerHTML");

			var vgoods_is_free_deposit = $("input[name='goods_is_free_deposit']").prop("checked");


			var vgoods_is_free_shipping = $("input[name='goods_is_free_shipping']").prop("checked");


			var vgoods_is_deductible = $("input[name='goods_is_deductible']").prop("checked");


			var vgoods_is_door = $("input[name='goods_is_door']").prop("checked");


			var vgoods_is_since = $("input[name='goods_is_since']").prop("checked");


			var vgoods_is_follow_lease = $("input[name='goods_is_follow_lease']").prop("checked");

			var vgoods_sku_attr_value = $("input[name='goods_sku_attr_value[]']").val();


			var vgoods_leasing_rules = $("#se1").val();


			//var vgoods_goods_detail_id = $("input[name='goods_goods_detail_id']").val();


			var vexpress_id = $("select[name='express_id']").val();

			var vtodoor = $("select[name='todoor']").val();

			var vgoods_is_verify_real_name = $("#id_bIsRealName").prop("checked");

			var vv = $('#div_main').prop('innerHTML');
			$('#div_main1').html(vv);

			$("#div_main1 input[name='goods_name']").val(vgoods_name);

			$("#div_main1 span_catname").html(vcatName);

			if (vgoods_is_free_deposit) {
				$("#div_main1 input[name='goods_is_free_deposit']").prop("checked", true);
			}
			if (vgoods_is_free_shipping) {
				$("#div_main1 input[name='goods_is_free_shipping']").prop("checked", true);
			}
			if (vgoods_is_deductible) {
				$("#div_main1 input[name='goods_is_deductible']").prop("checked", true);
			}
			if (vgoods_is_door) {
				$("#div_main1 input[name='goods_is_door']").prop("checked", true);
			}
			if (vgoods_is_since) {
				$("#div_main1 input[name='goods_is_since']").prop("checked", true);
			}
			if (vgoods_is_follow_lease) {
				$("#div_main1 input[name='goods_is_follow_lease']").prop("checked", true);
			}


			//颜色----------------------------------------------------
			$("input[name='value[颜色][]']").each(
				function (i) {
					$("#div_main1 input[name='value[颜色][]']").eq(i).val($(this).val());
				});
			//规格----------------------------------------------------
			$("input[name='value[规格][]']").each(
				function (i) {
					$("#div_main1 input[name='value[规格][]'").eq(i).val($(this).val());
				});

			//颜色----------------------------------------------------
			$("input[name='color[]']").each(
				function (i) {
					$("#div_main1 input[name='color[]']").eq(i).val($(this).val());
				});
			//规格----------------------------------------------------
			$("input[name='guige[]']").each(
				function (i) {
					$("#div_main1 input[name='guige[]']").eq(i).val($(this).val());
				});
			//市场价----------------------------------------------------
			$("input[name='market_price[]']").each(
				function (i) {
					$("#div_main1 input[name='market_price[]']").eq(i).val($(this).val());
				});
			//押金----------------------------------------------------
			$("input[name='goods_deposit[]']").each(
				function (i) {
					$("#div_main1 input[name='goods_deposit[]']").eq(i).val($(this).val());
				});
			//最小租用周期----------------------------------------------------
			$("input[name='rent_period_min_rent[]']").each(
				function (i) {
					$("#div_main1 input[name='rent_period_min_rent[]']").eq(i).val($(this).val());
				});
			//最大租用周期----------------------------------------------------
			$("input[name='rent_period_max_rent[]']").each(
				function (i) {
					$("#div_main1 input[name='rent_period_max_rent[]']").eq(i).val($(this).val());
				});
			//原租价----------------------------------------------------
			$("input[name='rent_period_old_rent_price[]']").each(
				function (i) {
					$("#div_main1 input[name='rent_period_old_rent_price[]']").eq(i).val($(this).val());
				});
			//现租价----------------------------------------------------
			$("input[name='rent_period_now_rent_price[]']").each(
				function (i) {
					$("#div_main1 input[name='rent_period_now_rent_price[]']").eq(i).val($(this).val());
				});
			//最少提前----------------------------------------------------------------
			$("input[name='rent_period_min_advance[]']").each(
				function (i) {
					$("#div_main1 input[name='rent_period_min_advance[]']").eq(i).val($(this).val());
				});
			//最多提前----------------------------------------------------------------
			$("select[name='rent_period_max_advance[]']").each(
				function (i) {
					$("#div_main1 select[name='rent_period_max_advance[]']").eq(i).val($(this).val());

				});
			$("input[name='relet_discount[]']").each(
				function (i) {
					$("#div_main1 input[name='relet_discount[]']").eq(i).val($(this).val());
				});
			//租赁合约模板----------------------------------------------------------------
			$("#div_main1 select[name='goods_leasing_rules']").val(vgoods_leasing_rules);
			//快递模板----------------------------------------------------------------
			$("#div_main1 select[name='express_id']").val(vexpress_id);
			//上门模板-------------------------------------------------------------
			$("#div_main1 select[name='todoor']").val(vtodoor);
			//自提点-----------------------------------------------------------------
			$("#div_main input[name='since_id[]']").each(
				function (i) {
					//alert($(this).prop("checked"));
					if ($(this).prop("checked")) {
						$("#div_main1 .inputd").eq(i).prop("checked", true);
					}
				}
			);
			//归还地址是否实名认证-------------------------------------------------------------------------
			$("#div_main input[name='goods_revert_id[]']").each(
				function (i) {
					//alert($(this).prop("checked"));
					if ($(this).prop("checked")) {
						$("#div_main1 .input").eq(i).prop("checked", true);
					}
				}
			);
			//是否实名认证-------------------------------------------------------------
			if (vgoods_is_verify_real_name) {
				$("#div_main1 input[name='goods_is_verify_real_name'][value=1]").attr("checked", true);
				$("#div_main1 input[name='goods_is_verify_real_name'][value=2]").attr("checked", false);
			} else {
				$("#div_main1 input[name='goods_is_verify_real_name'][value=1]").attr("checked", false);
				$("#div_main1 input[name='goods_is_verify_real_name'][value=2]").attr("checked", true);
			}
			$("#div_main1 .btn").each(
				function () {
					$(this).attr("disabled", "disabled");
				}
			);
			$("#portocol").modal("show");
		}
		function hidedetails() {
			$("#portocol").modal("hide");
			$('div_main1').html('');
		}
		//消费者每笔订单限租件数最高为50件
		function checkMaxCount(obj) {
			if ($(obj).val() > 50) {
				$(obj).val(50);
			}
			if ($(obj).val() <= 0 && $(obj).val()!='') {
				$(obj).val(1);
			}
			$(obj).val(parseInt($(obj).val()));
		}

		
	</script>
</body>

</html>